package datasv.framework_datasv;

import java.rmi.RemoteException;

import po.ModelPO;
import resultmessage.FrameworkRM;

public class AddModelReturnID {
	public static void main(String[] args) {
		System.out.println(new AddModelReturnID().addModelReturnID("000",null));
	}
	public String addModelReturnID(String collegeID,ModelPO model){
		return addInSql(collegeID,model);
	}
	private String addInSql(String collegeID,ModelPO model){
		if(!new AddModel().addModel(collegeID, model).equals(FrameworkRM.SUCCESS)){
			return "";
		}
		int m=0;
		try {
			m=new FrameworkDatasvController().getCollegeModel(collegeID).size();
			if(!collegeID.equals("000")){m=m+1;}
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(m==0){
			return "";
		}
		return collegeID+"01"+"0"+Integer.toString(m);
	}
}
